package com.itany.controller;

import com.github.pagehelper.PageInfo;
import com.itany.service.MessageService;
import com.itany.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Author:yaozhiyuan0117@163.com
 * Time:2019/12/20 19:34
 * Describe:
 * version:1.0
 */

@RestController
@RequestMapping("/messages")
public class MessageController {

    @Autowired
    MessageService messageService;
    @RequestMapping("/findByPage")
    public Map findByPage(Integer page, Integer rows,String sender, String receiver, String status){

        HashMap map = new HashMap();
        map.put("sender",sender);
        map.put("receiver", receiver);
        map.put("status", status);
        PageInfo info  =messageService.findByPage(page,rows,map);
        Map m = new HashMap();
        m.put("total", info.getTotal());
        m.put("rows",info.getList());
        return m;
    }
}
